package com.zsk.shop.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zsk.shop.entity.ShopGoodsSku;
import org.apache.ibatis.annotations.Update;

/**
 * @author Administrator
 */
public interface ShopGoodsSkuMapper extends BaseMapper<ShopGoodsSku> {

    /**
     * 更新库存
     * @param bizNo
     * @param number
     * @return
     */
    @Update("UPDATE shop_goods_sku SET stock = stock-#{number} WHERE biz_no = #{bizNo}")
    int updateGoodsSkuStock(String bizNo, Integer number);


    /**
     * 增加库存
     * @param bizNo
     * @param number
     * @return
     */
    @Update("UPDATE shop_goods_sku SET stock = stock+#{number} WHERE biz_no = #{bizNo}")
    int addGoodsSkuStock(String bizNo, Integer number);
}